package com.red.star.wechat.work.utils;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @ProjectName: macalline-work-server
 * @Package: com.red.star.macalline.work.utils
 * @Description:
 * @Author: AMGuo
 * @CreateDate: 2018/6/28 下午3:29
 * @Version: 1.0
 */
public class IncomeStatusUtil {

    //未结算
    public static final int STATUS_CODE_0 = 0;

    public static final String STATUS_TEXT_0 = "未结算";

    //结算中
    public static final int STATUS_CODE_1 = 1;

    public static final String STATUS_TEXT_1 = "结算中";

    //已结算
    public static final int STATUS_CODE_2 = 2;

    public static final String STATUS_TEXT_2 = "已结算";

    //已清零
    public static final int STATUS_CODE_3 = 3;

    public static final String STATUS_TEXT_3 = "已清零";

    /**
     * 通过code返回text
     *
     * @param statusCode
     * @return
     */
    public static String getStatusText(Integer statusCode) {
        if (null == statusCode) {
            return null;
        }
        String text = "";
        switch (statusCode) {
            case STATUS_CODE_0:
                text = STATUS_TEXT_0;
                break;
            case STATUS_CODE_1:
                text = STATUS_TEXT_1;
                break;
            case STATUS_CODE_2:
                text = STATUS_TEXT_2;
                break;
            case STATUS_CODE_3:
                text = STATUS_TEXT_3;
                break;
        }
        return text;
    }

    public static List<IncomeStatus> list() {
        List<IncomeStatus> mapList = Lists.newArrayList();
        mapList.add(new IncomeStatus(STATUS_CODE_0, STATUS_TEXT_0));
        mapList.add(new IncomeStatus(STATUS_CODE_1, STATUS_TEXT_1));
        mapList.add(new IncomeStatus(STATUS_CODE_2, STATUS_TEXT_2));
        mapList.add(new IncomeStatus(STATUS_CODE_3, STATUS_TEXT_3));
        return mapList;
    }

    static class IncomeStatus {
        private Integer code;

        private String text;

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public IncomeStatus() {
        }

        public IncomeStatus(Integer code, String text) {
            this.code = code;
            this.text = text;
        }
    }
}
